/*
 * Copyright © 2021 Dowsure
 * https://www.dowsure.com/
 *
 * All rights reserved.
 */

package com.dowsure.apisaas.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @description: 请求参数验证
 * @author: Dowsure
 * @create: 2021-12-08 16:15
 **/
@Documented
@Target({ FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface RequestParamValidated {

    /**
     * 是否必填，默认 false
     */
    boolean required() default false;

    /**
     * 描述
     */
    String msg() default "";

    /**
     * 最大长度，默认：0，0表示不做校验，值必须为正整数；
     */
    int maxLen() default 0;

    /**
     * 格式
     */
    String format() default "";

    Class<?>[] groups() default { };

    /**
     * Defines several {@code @NotBlank} constraints on the same element.
     *
     * @see RequestParamValidated
     */
    @Target({ FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
    @Retention(RUNTIME)
    @Documented
    public @interface List {
        RequestParamValidated[] value();
    }
}
